const UiManager = {
    createDebugButton(lastResponseData) { // 获取所有符合条件的ul元素
        const ulElements = document.querySelectorAll('.mini-grid-rows-lock-right table tr td:first-child ul.toolbar-panel-right');
        const btnText = '本地测试';
        // 为每个ul添加li元素并绑定点击事件
        ulElements.forEach((ul, rowIndex) => {
            // 创建新的li元素
            const newLi = document.createElement('li');
            newLi.setAttribute('data-type', 'button');
            newLi.setAttribute('data-buttontitle', btnText);
            newLi.setAttribute('referencingcontrolid', 'appGrid');

            // 创建div元素
            const divElement = document.createElement('div');
            divElement.className = 'menubar-panel-item miniux-button miniux-button-link miniux-button-type-default';
            divElement.textContent = btnText;

            // 将div添加到li中
            newLi.appendChild(divElement);

            // 绑定点击事件
            newLi.addEventListener('click', function (event) {
                event.preventDefault();
                event.stopPropagation();

                // 获取当前行的数据或相关信息
                console.log('Debug按钮被点击，requestId:', lastResponseData.data[rowIndex].requestId);
                RequestERP.sendMessageLogDetail(lastResponseData.data[rowIndex].requestId).then(requestDetail => {
                    RequestLocal.postLocal(requestDetail.data).then((responseData) => {
                        LogPage.openPage(requestDetail.data, responseData.data, responseData.curl);
                    });
                });
            });

            // 将li插入到ul的开头
            ul.insertBefore(newLi, ul.firstChild);
        });
    }
};